import 'package:flutter/material.dart';

/// lib/ch/ch05/hello_world.dart
///
/// 极客时间陈航flutter ch05
///

void main()=>runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) => const MaterialApp(
      home:MyHomePage(title: 'Flutter Demo Home Page',)
  );
}

class MyHomePage extends StatefulWidget {
  final String title;
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  @override
  State<StatefulWidget> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;
  void _incrementCounter() => setState(() { _counter++; });
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(widget.title),),
      body: Text(
        'You have pushed the button this many times:$_counter',
        style: const TextStyle(fontSize: 24.0),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        child: const Icon(Icons.add, color: Colors.white,),
      ),
    );
  }
}

